# -*- coding: utf-8 -*-
from main import sumTo
from time import time

def pySumTo(start: int, to: int, length: int) -> int:
    if length == 0:
        return 0
    sumValue = 0
    for i in range(start, to, length):
        sumValue += i
    return sumValue

c = 1000
toValue = 10000

s = time()
for _ in range(c):
    pySumTo(0, toValue, 1)

print(f"py耗时: {round(time() - s, 3)}s")

s = time()
for _ in range(c):
    sum(range(toValue))

print(f"py内建库耗时: {round(time() - s, 3)}s")

s = time()
for _ in range(c):
    sumTo(0, toValue, 1)

print(f"native耗时: {round(time() - s, 3)}s")
